
const express =require(`express`)


const path =require(`path`)

const app =express()

app.use(express.urlencoded())
app.use(express.json())


app.post(`/add`,(req,res)=>{
  
  const {name,age,sex} =req.body

  
  res.send({
    data:{
      name:11,
      age:11,
      sex:22
    }
  })
})


// app.get(`/3`,(req,res)=>{

//   const filePath =path.resolve(__dirname,`./post.html`)
//   res.sendFile(filePath)

// })

app.get("/4", (req, res) => {
  const filePath = path.resolve(__dirname, "./post.html");
  // const filePath = path.resolve(__dirname, "./jquery.html");
  res.sendFile(filePath);
})


// app.get("/4",(req,res)=>{

//   const filePath = path.resolve(__dirname,`./axios.html`)

//   res.sendFile(filePath)
// })



app.listen(3000,()=>{
  console.log(`success`);
})